#include "Table.h"

using namespace std;

Table::Table(int startX, int startY, string name, QGraphicsScene *scene)
	: TableInterface(name), GUIBase()	//TODO
{
	loadImage("Resources/Sprites/Table.png");

	this->setX(startX);
	this->setY(startY);
	this->setZValue(ZVALUE_TABLE);

}

Table::Table()
	: TableInterface("Table"), GUIBase("TEST")
{
	
}

void Table::doneScaling()
{
	this->setScaleSpeed(0.1);
}

void Table::insert(Kit* data, int index) {
	if(kits[index] != NULL || index < 0 || index >= 3) {
		//ThrowError();
	} else if(kits[index] == NULL) {
		kits[index] = data;
		data->moveInstantlyTo(x()+24 , this->y() +21+ 40 * index);
		data->rotateInstantlyTo(0);
	} //kits get lined up with table slot 
}


//GUI stuff
//Chandler    
QPoint Table::getTableSlotPosition(int slot)
{
	
		//COMMENTED OUT FOR AGENT TESTS
	 int y;

	 int x= this->x() + 24; //x will be the same for each slot 
	// y=this->y() + this->boundingRect().height()/(3 - slot);//+ TABLE_GAP * (slot+1);
	 y = this->y() + (38) * slot+30;

	
	 return QPoint(x,y);
	 

	return QPoint(0,0);
}
